<?php

$child_pid = pcntl_fork();
if( $child_pid ) {
    exit(0);
}
posix_setsid();

define('SITE_DIR',dirname(__FILE__) . '/..');
require_once dirname(__FILE__) . '/../../projects/bazalt/framework/core/include.inc';

using('Framework.System.Config');
using('Framework.System.Error');
Error::setFormat(Error::ConsoleFormat);

using('Framework.System.Orm');

require_once  'include.inc';

class Main
{
    private static $config;

    public static function loadConfig()
    {
        self::$config = WebConfigReader::load('web.config');
    }

    public static function start()
    {
        self::loadConfig();
 
        try {
            $f = new DaemonFactory();
            $f->run();
        } catch (Exception $exception) {
            die( "\n" . $exception->getMessage() . "\n" );
        }
    }
}

Main::start();